package View;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import Listener.LMouseJTableRightClick;
import Model.ListeUtilisateur;
import Model.Privilege;

public class PanneauTableauUtilisateur extends JPanel {
	private static final long serialVersionUID = 1L;

	public PanneauTableauUtilisateur(ListeUtilisateur listUser) {
		
		JTable tableau = new JTable(listUser);
		JScrollPane scrollPane = new JScrollPane(tableau);
		
		tableau.addMouseListener(new LMouseJTableRightClick(listUser));
		
		// renderer
		tableau.getColumn("Privilège").setCellRenderer(new RendererPrivilege());
		
		//Editor
		Privilege [] tabPrivilege = {new Privilege(Privilege.Admin), new Privilege(Privilege.Utilisateur), new Privilege(Privilege.Invite)};
		tableau.getColumn("Privilège").setCellEditor(new EditorPrivilege(tabPrivilege));
		
		
		
		this.setLayout(new BorderLayout());
		this.add(scrollPane, BorderLayout.CENTER);
	}

}
